/*
 * Copyright 2010-2012 Susanta Tewari. <freecode4susant@users.sourceforge.net>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package genomemap.netbeans.jobs1.data;

import cef.command.Command;
import cef.pui.EventConstructionException;
import commons.nb.data.gui.properties.DataPropertys;
import commons.nb.jobs.Job;
import commons.nb.jobs.properties.BuilderProperty;
import genomemap.cef.command.ClassifyGenes_Cmd;
import genomemap.cef.command.listener.ClassifyGenes_PW;
import genomemap.cef.pui.ClassifyGenes_EvtImpl;
import genomemap.nb.jobs.properties.Propertys_Gen;

import java.util.Properties;

/**
 * @author Susanta Tewari
 * @since Jun 17, 2011
 */
public class ClassifyGenesJob extends Job<ClassifyGenes_EvtImpl> {

    private final BuilderProperty prop_data;

    public ClassifyGenesJob() {

        setName("Classify Input Genes");
        setDisplayName("Classify Input Genes");
        setShortDescription("Classifies Input Genes");


        // data
        addComboProperty(Propertys_Gen.BUILDER_DATA_OrganismData());    // organism
        addComboProperty(prop_data = DataPropertys.StringList_BUILDERS());    // string-list


        // listeners
        addCommandOutputListener(new ClassifyGenes_PW());
    }

    @Override
    protected ClassifyGenes_EvtImpl createEvent() throws EventConstructionException {

        final String prefix         = "commons.builder.StringList";
        final Properties properties = getProperties();

        prop_data.setKeyPrefix(prefix);
        properties.setProperty(prefix + ".delegate", prop_data.getValue().getBuilderString());

        return new ClassifyGenes_EvtImpl(getProperties());
    }

    @Override
    protected Command createCommand(final ClassifyGenes_EvtImpl event) {
        return new ClassifyGenes_Cmd(event);
    }

    @Override
    public boolean isCancellable() {
        return ClassifyGenes_Cmd.isCancellable();
    }

    @Override
    public Class<ClassifyGenes_EvtImpl> getEventImplType() {
        return ClassifyGenes_EvtImpl.class;
    }
}
